﻿@model ValueTuple<IEntity, DataField>
@using NewLife;
@using NewLife.Cube
@using XCode;
@using XCode.Configuration;
@{
    var entity = Model.Item1;
    var field = Model.Item2;

    var value = entity[field.Name] as String;

    //var atts = HtmlHelper.AnonymousObjectToHtmlAttributes(Model.HtmlAttributes);
    //if (!atts.ContainsKey("class")) atts.Add("class", "form-control");

    var accept = "";
    if (field.ItemType.EqualIgnoreCase("image")) accept = "image/*";
}
@Html.TextBox(field.Name, entity[field.Name], new { @class = "form-control" })
@Html.TextBox(field.Name+"_attachment", entity[field.Name], new { type = "file", accept })
@if (!value.IsNullOrEmpty())
{
    <a href="@value">下载</a>
}